home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / FromTheMag / JW FLV MEDIA PLAYER 4.2 / mediaplayer.exe / player.swf / scripts / com / jeroenwijering / parsers / MediaParser.as < prev    next >
Text File  |  2008-11-04  |  2KB  |  58 lines

  1. package com.jeroenwijering.parsers
  2. {
  3.    import com.jeroenwijering.utils.Strings;
  4.    
  5.    public class MediaParser extends ObjectParser
  6.    {
  7.        
  8.       
  9.       public function MediaParser()
  10.       {
  11.          super();
  12.       }
  13.       
  14.       public static function parseGroup(param1:XML, param2:Object) : Object
  15.       {
  16.          var _loc3_:XML = null;
  17.          for each(_loc3_ in param1.children())
  18.          {
  19.             switch(_loc3_.localName())
  20.             {
  21.                case "content":
  22.                   if(!param2["file"] && ObjectParser.MIMETYPES[_loc3_.@type.toString()])
  23.                   {
  24.                      param2["file"] = _loc3_.@url.toString();
  25.                      param2["type"] = _loc3_.@type.toString();
  26.                      if(_loc3_.@duration)
  27.                      {
  28.                         param2["duration"] = Strings.seconds(_loc3_.@duration);
  29.                      }
  30.                      if(_loc3_.@start)
  31.                      {
  32.                         param2["start"] = Strings.seconds(_loc3_.@start);
  33.                      }
  34.                   }
  35.                   if(_loc3_.children().length() > 0)
  36.                   {
  37.                      param2 = parseGroup(_loc3_,param2);
  38.                   }
  39.                   break;
  40.                case "description":
  41.                   param2["description"] = _loc3_.text().toString();
  42.                   break;
  43.                case "thumbnail":
  44.                   param2["image"] = _loc3_.@url.toString();
  45.                   break;
  46.                case "credit":
  47.                   param2["author"] = _loc3_.text().toString();
  48.                   break;
  49.                case "keywords":
  50.                   param2["tags"] = _loc3_.text().toString();
  51.                   break;
  52.             }
  53.          }
  54.          return param2;
  55.       }
  56.    }
  57. }
  58.